<template>
  <div>
    <h2 id="box1">电器</h2>
    <div class="chart1" ref="chart1" id="chart1">tu</div>
  </div>
</template>
<script>
import * as echarts from "echarts";
export default {
  mounted() {
    let dom = this.$refs['chart1'];
    let chart1 = echarts.init(dom);
    let option = {
      xAxis: {
        data: ['手机', '电脑', '平板', '键盘'],
        type: 'category'
      },
      yAxis: {
        type: 'value'
      },
      series: {
        data: [1999, 5999, 3999, 199],
        type: 'bar'
      }

    };
    chart1.setOption(option);
  }
};


</script>
<style lang="less">
#box1 {
  color: blue;
  text-align: center;
}

.chart1 {
  height: 320px;
}
</style>